<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/ext/resources/css/ext-all.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/test/excelpanel/ExcelPanel.css">
		<script type="text/javascript" src="${pageContext.request.contextPath}/ext/adapter/ext/ext-base.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/ext/ext-all.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/ext/ExcelPanel.js"></script>
		<script type="text/javascript">
	function getPath()
	{
		 var htmlpath = window.location.href;
		   var dirpath = htmlpath;
		   if(htmlpath.substring(0,8) == "file:///") dirpath = dirpath.substring(8);
		   dirpath  = dirpath.substring(0,dirpath.lastIndexOf("/"));
		   dirpath = dirpath.split("/").join("\\");
		   
		   return dirpath + "\\";
	}
	
	var disableBtns = ["savecopy","print","preview","zoomin","zoomout","test"];
	
	Ext.onReady(function(){    

      var p = new Ext.ux.ExcelPanel({
       
        xls : "D:\\java\\workspace\\jdt\\web\\test\\excelpanel\\ExcelPanel.xls",
        title:'Ext.ux.ExcelPanel Extension by kimmking',
        height:700,
        width:1200,
        //titleCollapse : true,
        //collapsible : true,
        //draggable : true,
        tbar : [{
					id : 'create',
					iconCls : 'create',
					text : '新建',
					tooltip : '新建',
					handler : function(btn)
								{
									p.create();
									
									
									Ext.each(disableBtns,function(item){
										Ext.getCmp(item).enable();
									});
								}
				},
				{
					id : 'open',
					iconCls : 'open',
					text : '打开',
					tooltip : '打开',
					handler : function(btn)
								{
									p.open(getPath()+"ExcelPanel.xls");
									
									Ext.each(disableBtns,function(item){
										Ext.getCmp(item).enable();
									});
								}
				},
				{
					id : 'savecopy',
					iconCls : 'saveas',
					text : '另存',
					tooltip : '另存',
					handler : function(btn)
								{
									p.saveCopy();
								}
				},
				{
					id : 'print',
					iconCls : 'print',
					text : '打印',
					tooltip : '打印',
					handler : function(btn)
								{
									p.print();
								}
				},
				{
					id : 'preview',
					iconCls : 'preview',
					text : '预览',
					tooltip : '打印预览',
					handler : function(btn)
								{
									p.preview();
								}
				},
				{
					id : 'zoomin',
					iconCls : 'zoomin',
					text : '放大',
					tooltip : '放大',
					handler : function(btn)
								{
									p.zoomin();
								}
				},
				{
					id : 'zoomout',	
					iconCls : 'zoomout',						
					text : '缩小',
					tooltip : '缩小',
					handler : function(btn)
								{
									p.zoomout();
								}
				},
				{
					text : '关闭',
					iconCls : 'close',
					tooltip : '关闭',
					handler : function(btn)
								{
									p.close();
									
									Ext.each(disableBtns,function(item){
										Ext.getCmp(item).disable();
									});
									
								}
				},
				{
    				id : 'test',
					text : 'test',
					iconCls : 'test',
					tooltip : 'test',
					handler : function(btn)
								{
									alert("[1,1] = "+ p.getCellValue(1,1));
								}
				}
				
				
				]
        
      });
      
      p.render(document.body);

  
  });
	
	</script>
		<title id="page-title">Ext.ux.ExcelPanel</title>
	</head>
	<body>


	</body>
</html>